﻿using System.IO;
using RFS.BizLogic.Sys;
using RFS.BizLogic.Sys.impl;
using RFS.Domain.Sys;

namespace RFS.BizLogic
{
    public static class Starter
    {
       private static IAntiObject _antiObject;
       // public static IAntiObject StaticEvn => _antiObject ?? (_antiObject = StartApp() );

       public static IAntiObject StartApp(bool isTest=false)
       {
           // Console.OutputEncoding = Encoding.UTF8;

           if (isTest)
           {
               if (_antiObject == null)
               {
                   _antiObject =   AntiObject.OfTestSandbox();
               }
              
           }
           else
           {
               
               if (_antiObject == null)
               {
                   _antiObject =  AntiObject.Ins;
               }
                            
               
           }

           


           _antiObject.Get<IConfigT>().ConfigSys.TestMode = isTest;
           
           return _antiObject;
        }


       public static void CleanEvn()
       {
           try
           {
               Directory.Delete("tem", true);
           }
           catch
           { }
       }
    }
}